<template>
	<view class="videoPage">
		<video id="myVideo" @error="videoErrorCallback" :show-loading="true" v-show="videoSrc!=''" :src="videoSrc" :autoplay="true"
		 controls style="width: 100%;" :style="{height:windowHeight}" ></video>
		 <!-- <video src="https://www.runoob.com/try/demo_source/movie.mp4"></video> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				windowHeight: ""
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.src); //打印出上个页面传递的参数。
			//打印出上个页面传递的参数
			var that=this
			this.videoSrc = option.src

			uni.getSystemInfo({
				success(res) {
					that.windowHeight = res.windowHeight + "px"
					console.log(that.windowHeight)
				}
			})

		},
		methods: {
			videoErrorCallback: function() {
				uni.showModal({
					content: '视频加载失败',
					showCancel: false
				})
			},
		}
	}
</script>

<style scoped>
	.videoPage {
		width: 100%;
		height: 100%;
	}
</style>
